home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 12 / Mac Magazin and MacEasy Magazine CD - Issue 12.iso / CD Extras / Plug-ins / SODAColor / SODA-PlugIns-1 / Plug-In-Collection-1 / Transparent Script < prev   
Text File  |  1994-11-07  |  4KB  |  125 lines

  1. --SODABuildPlug
  2. --Transparent Button
  3.  
  4. ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
  5. SODAColor™
  6. Transparent Button :
  7.  
  8. This plug-in allows you to create transparent buttons in SODAColor which execute HyperTalk scripts.
  9.  
  10. LOADING THIS SCRIPT INTO SODACOLOR:
  11. 1.  Select "Load New Plug-In" from the plug-in list (TV-icon on edit palette).
  12. 2.  Select this document.
  13.  
  14. USING THIS PLUG-IN:
  15. 1.  Write a HyperTalk script in the dialog box using semicolons (;) in place of return characters.
  16. 2.  TEST this script after writing it.  If you don't, you may not be able to get rid of the button.  (To get rid of ALL card-layer buttons, select the plug-in "Remove Extra Buttons")
  17. 3.  BUILD this script when you are satisfied with it.
  18. 4.  Drag a rectangle over the area of the screen you want this button to cover
  19. 5.  Tell SODAColor whether or not you want this button hilited when clicked.
  20.   
  21. ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
  22. on mouseUp
  23.   global CardNameList
  24.   createCardNameList
  25.   put "This plug-in allows you to run a script by clicking over a transparent button on the screen." into myprompt
  26.   put "Do you want to create this?" into prompt2
  27.   
  28.   answer myPrompt&return&return&prompt2 with "Cancel" or "Build it!"
  29.   if it is "Cancel" then exit mouseUp
  30.   
  31.   
  32.   put makeScript() &return into myScript
  33.   if myScript is empty then exit mouseUp
  34.   answer"Now please drag a rectangle over the area you want your button to cover"
  35.   
  36.   put sodaRect() into myRect
  37.   lock screen
  38.   choose tool 2
  39.   put the number of cd btns into myBNum
  40.   domenu "New Button"
  41.   put myBNum+1 into myBNum
  42.   put "Linker"&&MyBnum into myBName
  43.   
  44.   if there is not a cd btn myBNum then
  45.     answer "Problem encountered.  Please make sure you're on the card layer"
  46.     exit mouseUp
  47.   end if
  48.   
  49.   set the name of cd btn myBNum to myBName
  50.   set the rect of cd btn myBName to myRect
  51.   set the showname of cd btn myBName to false
  52.   set the style of cd btn myBName to transparent
  53.   set the autohilite of cd btn myBname to true
  54.   
  55.   --Autohilite?
  56.   
  57.   answer "Do you want this button to invert when pressed?" with "No" or "Yes"
  58.   if it is "No" then set the autohilite of cd btn myBName to false
  59.   
  60.   --Link Script:
  61.   
  62.   
  63.   put "Set the hilite of me to false" after myScript
  64.   put the script of bg btn "SODAPlugButt" into nuScript
  65.   put myScript into line 20 of nuScript
  66.   
  67.   --Flashing rect whilst repositioning:
  68.   
  69.   put " repeat until the mouseClick"&return into Repos
  70.   put "set the hilite of me to true"&return after Repos
  71.   put "set the hilite of me to false"&return after Repos
  72.   put Repos into line 5 of nuScript
  73.   
  74.   --Now Insert the Script:
  75.   
  76.   set the script of cd btn myBName to nuScript
  77.   
  78.   --Inform user:
  79.   
  80.   answer "•Option-Click on this button to re-position it."&return&¬
  81.   "•Command-Click to delete it"&return&"•Single-Click to run its script."
  82.   
  83.   choose tool 1
  84.   
  85. end mouseUp
  86.  
  87. function makeScript
  88.   global myMacro
  89.   put "--Use this format:"&return&return&¬
  90.   "reset paint;choose tool 16;click at ""e&"200,200""e&"; type ""e&"I Love SODAColor!""e&¬
  91.   ";Repeat 50 times;domenu""e&"Trace Edges""e&¬
  92.   ";end repeat;choose tool 1"&return&return&&return&return into nuScript
  93.   ask "Please enter a Hypertalk Script. "¬
  94.   &&"Remember to ONLY use semicolons (;) to signify ends of lines!" with nuScript
  95.   if it is empty then exit to HyperCard
  96.   put it into nuScript
  97.   put fixMacro(nuScript) into myCommand
  98.   put "Would you like to test this script  or build it?" into myPrompt
  99.   repeat forever
  100.     answer myPrompt with "Cancel" or "Build" or "Test"
  101.     if it is "cancel" then exit to HyperCard
  102.     if it is "Build" then
  103.       return myCommand
  104.       exit makeScript
  105.     end if
  106.     if it is "Test" then do myCommand
  107.     put "Would you like to test this script again, or are you ready to install it?" into myPrompt
  108.   end repeat
  109. end makeScript
  110.  
  111.  
  112. function fixMacro myText
  113.   repeat with x=1 to the number of chars in myText
  114.     if char x of myText=";" then
  115.       put return after myResp
  116.     else put char x of myText after myResp
  117.   end repeat
  118.   return myResp
  119. end fixMacro
  120.  
  121.  
  122.  
  123.  
  124.  
  125.